package com.neuedu.his.controller;


import com.neuedu.his.entity.CheckApply;
import com.neuedu.his.entity.InspectApply;
import com.neuedu.his.entity.Register;
import com.neuedu.his.framework.servlet.BaseServlet;
import com.neuedu.his.service.DoctorService;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 项目：      his
 * 类名:       UserController
 * 创建时间：  2020/12/22  11:05
 * 描述 :
 * 作者 :     张金山
 * QQ :     314649444
 * Site:      https://jshand.gitee.io
 */
@WebServlet(name = "DoctorController", urlPatterns = "/doctor")
public class DoctorController extends BaseServlet {

    private DoctorService doctorService = new DoctorService();


    /**
     * 医生提交 患者信息【主诉】 、【现病史】等
     */
    public void finish(HttpServletRequest request, HttpServletResponse response) throws IOException, InstantiationException, IllegalAccessException {
        Register register = parseParameter(request,Register.class);

        boolean success = doctorService.finish(register);

        super.success(response,success);
//        super.out(response,success);
    }




    /**
     * 医生提交 患者信息【主诉】 、【现病史】等
     */
    public void submit(HttpServletRequest request, HttpServletResponse response) throws IOException, InstantiationException, IllegalAccessException {
        Register register = parseParameter(request,Register.class);

        boolean success = doctorService.submit(register);

        super.success(response,success);
//        super.out(response,success);
    }


    /**
     * 申请检查
     * @param request
     * @param response
     * @throws IOException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    public void checkApply(HttpServletRequest request, HttpServletResponse response) throws IOException, InstantiationException, IllegalAccessException {
        /**
         *  病历号: registerId
         *     项目id  [1,2 ,3]
         */

        boolean success = doctorService.checkAplly(request);

        //输出成功\否
        super.success(response,success);

    }


    /**
     * 根据环 患者好 病历号 查询开立的检查列表
     * @param request
     * @param response
     * @throws IOException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    public void checkApplyList(HttpServletRequest request, HttpServletResponse response) throws IOException, InstantiationException, IllegalAccessException {

        List<CheckApply> checkApplyList = doctorService.checkApllyList(request);


        super.success(response,checkApplyList);

    }

    /**
     * 申请检验
     * @param request
     * @param response
     * @throws IOException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    public void inspectApply(HttpServletRequest request, HttpServletResponse response) throws IOException, InstantiationException, IllegalAccessException {
        /**
         *  病历号: registerId
         *     项目id  [1,2 ,3]
         */

        boolean success = doctorService.inspectApply(request);

        //输出成功\否
        super.success(response,success);

    }


    /**
     * 根据环 患者好 病历号 查询开立的检验列表
     * @param request
     * @param response
     * @throws IOException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    public void inspectApplyList(HttpServletRequest request, HttpServletResponse response) throws IOException, InstantiationException, IllegalAccessException {

        List<InspectApply> inspectApllyList = doctorService.inspectApllyList(request);


        super.success(response,inspectApllyList);

    }



}